import React, { ReactNode, useEffect, useState } from "react";
import { View, Button, Text } from "@moyoko/components";
import useShareAppMessage from "@packages/runtime/src/hooks/useShareAppMessage";
// import { useSelector } from "react-redux";
import "./app.css";
interface Props {
  children: ReactNode;
}

const sad = { a: 1 };

let xi = sad?.a?.b;
console.log(xi);

// const onShareAppMessage = function () {};
// const useShareAppMessage = function () {};
export default function Home(props: Props) {
  const [i, setI] = useState(1);
  // const _state = useSelector((state) => state);
  // console.log("state:", _state);
  useShareAppMessage((event) => {
    return {
      title: "233",
    };
  });

  useEffect(() => {
    console.log("home: useEffect");
  }, []);

  return (
    <View
      className="inH5"
      onClick={(event) => {
        console.log("addd1");
        ////  ++xi;
        setI((val) => {
          return val + 1;
        });
      }}
    >
      abcd, {i}, test
      <View
        className="sfaa11"
        onClick={(event) => {
          event.stopPropagation();
          console.log("11122");
        }}
      >
        asf
      </View>
      <Button
        openType="share"
        className="button"
        onClick={(event) => {
          event.stopPropagation();
          console.log("Button");
        }}
      >
        <Text>hello，world</Text>
      </Button>
    </View>
  );
}
